<!DOCTYPE html>
<html>
<head>
<script src='../cspy/cspy.js' type='text/javascript'></script>
<script src='m1.py' type='text/python'></script>
<script type='text/python'>
	import m1
	
	def onload(*args):
		print(args)
</script>
<script type='application/javascript;version=1.8'>
	'use strict';
	
	/*
	class A:
		aa = 'AA'
		
		def __call__(*args, **kwargs):
			return 'A', args, kwargs
	*/
	var A = builtins.call([builtins.type, 'A', [], {
		aa: 'AA',
		
		__call__: function (args, kwargs){
			return ['A', args, kwargs];
		},
	}]);
	
	var a = builtins.call([A]);
	builtins.print([A, a]);
	
	/*
	class B(A):
		bb = 'BB'
		
		def __call__(*args, **kwargs):
			return 'B', args, kwargs
	*/
	var B = builtins.call([builtins.type, 'B', [A], {
		bb: 'BB',
		
		__call__: function (args, kwargs){
			return ['B', args, kwargs];
		},
	}]);
	
	var b = builtins.call([B]);
	builtins.print([B, b]);
	
	/*
	class C(B, A):
		cc = 'CC'
		
		def __new__(cls, *args, **kwargs):
			self = object.__new__(cls)
			return self
		
		def __init__(self, *args, **kwargs):
			self._cc1 = None
			self._cc2 = True
			self._cc3 = 1
			self._cc4 = 1.1
			self._cc5 = '1.1'
	*/
	var C = builtins.call([builtins.type, 'C', [B, A], {
		cc: 'CC',
		
		__new__: function (args, kwargs){
			var cls = args[0];
			var self = builtins.object.__new__(args, kwargs);
			return self;
		},
		
		__init__: function (args, kwargs){
			var self = args[0];
			self._cc1 = null;
			self._cc2 = true;
			self._cc3 = 1;
			self._cc4 = 1.1;
			self._cc5 = '1.1';
		},
	}]);
	
	var c = builtins.call([C]);
	builtins.print([C, c]);
	
	var C_call = builtins.getattr([C, '__call__']);
	var c_call = builtins.getattr([c, '__call__']);
	builtins.print([C_call, c_call]);
	
	builtins.print([builtins.call([c, 10, 20], {c: 30, d:'40'})]);
</script>
</head>

<body>
</body>
</html>
